<?php
namespace app\index\Controller;

use think\Request;
use think\Controller;
use think\Db;



class Index extends Controller
{
    public function index()
    {
        //轮廓图获取数据库的封面是1的图片
        $img = Db::table('banner')->where('face', 'EQ', '1')->select();
        $this->assign('imgs', $img);
        return $this->fetch('index/index');
    }
    //个人中心页面
    public function PersonalCenter()
    {
        $user = session('name', '','index');
        $result = Db::table('user')->where('username', 'EQ', $user)->field('username, email, phone, nickname, id , icon')->select();
        $this->assign('result', $result[0]);
        return view('index/PersonalCenter');
    }

    //登录页面
    public function login()
    {
        return view('index/login');
    }

    //修改密码页面
    public function faq()
    {
         $user = session('name', '','index');
         $result = Db::table('user')->where('username', 'EQ', $user)->field('icon')->select();
         $this->assign('result', $result[0]);
        return view('index/faq');
    }

     //收藏页面
     public function plans()
    {
        $user = session('name', '','index');
        $result = Db::table('user')->where('username', 'EQ', $user)->field('icon')->select();
        $this->assign('result', $result[0]);
        return view('index/plans');
    }

    //评论页面
    public function grid()
    {
        $user = session('name', '','index');
        $result = Db::table('user')->where('username', 'EQ', $user)->field('icon')->select();
        $this->assign('result', $result[0]);
        return view('index/grid');
    }

    // 订单管理页面
    public function charts()
    {
//         $user = session('name', '','index');
//         $result = Db::table('user')->where('username', 'EQ', $user)->field('icon')->select();
//         $this->assign('result', $result[0]);
        return view('index/charts');
    }
}
